home *** CD-ROM | disk | FTP | other *** search
- Path: informatik.tu-muenchen.de!schuenem
- From: schuenem@informatik.tu-muenchen.de (Ulf Schuenemann)
- Newsgroups: comp.lang.smalltalk,comp.object,comp.lang.c++,comp.lang.java
- Subject: Re: The Good, the Bad, the Ugly, and the Wicked ...
- Date: 12 Apr 1996 15:31:31 GMT
- Organization: Technische Universitaet Muenchen, Germany
- Distribution: world
- Message-ID: <4klt0j$i0m@sunsystem5.informatik.tu-muenchen.de>
- References: <31570B8E.5A12@vmark.com> <4je5rq$7qg@mimas.brunel.ac.uk> <4jes0t$gth@decaxp.HARVARD.EDU> <31630E30.5A02@oma.com> <4kbq3q$1i8@gaia.ns.utk.edu> <JSA.96Apr9131057@organon.com> <RMARTIN.96Apr10133335@rcm.oma.com> <JSA.96Apr11153135@organon.com>
- NNTP-Posting-Host: hpbroy7.informatik.tu-muenchen.de
- Originator: schuenem@hpbroy7.informatik.tu-muenchen.de
-
-
- [**] This is intended to be an information post.
-
- To the discussion Smalltalk vs C++ let me focus on the point
- of two classes of errors that may occure:
-
- a) access to illegal memory (here: released memory)
- b) calling illegal methods
-
- A language has three main choices what to do:
- #1 prohibit such errors
- #2 catch such errors and report them (some kind of exception mechanism)
- #3 don't bother - ie undefined behavior
- I count the catching of illegal memory access by the operating system
- (which, in unix, results in core dump) as #3.
-
- Means to achieve this:
- a) access to illegal memory b) calling illegal methods
- --------------------------------------------------------------------------
- #1 prohibit: GC-systems static typecheck
- #2 catch: bounds-checkers "Message not understood"
- #3 don't: - -
-
- In C++ access to memory that has been released by 'delete' is illegal.
- But what happens at runtime is implementation-defined.
- Most implementations do a-#3.
- Trying to achieving GC-semantics (a-#1) for an ordinary C++ program by
- making it's calls to 'delete' a no-op would allow access to an object
- who's destructor has been called - which is illegal.
-
- C++ is b-#1: All implemenations do static typecheck (as the language is
- defined in a way that makes static typecheck manageable).
-
- Smalltalk requires GC (a-#1) as it has no construct for releasing memory.
-
- I've only heard of implementations that do b-#2.
- I don't know the Smalltalk language definition to tell whether b-#3 is
- allowed or wheter the famous "Message not understood" is required.
- I estimate it would be impossible to do static typecheck in Smalltalk
- without a global data-flow-analysis.
-
- Result:
-
- Smalltalk: a-#1 b-#2
- C++: a-#3 b-#1
- Eiffel: a-#1 b-#1 [*]
- [*] I don't know how covariant overriding of parametertypes (which is not
- typesave but allowed Eiffel) is handled by Eiffel implementations.
-
- I obstain from any personal judgement.
-
- Ulf Schuenemann
-
- --------------------------------------------------------------------
- ,_. Ulf Schⁿnemann
- #, \ FakultΣt fⁿr Informatik, Technische UniversitΣt Mⁿnchen, Germany.
- | > email: schuenem@informatik.tu-muenchen.de
- v=-< WWW: http://hphalle2.informatik.tu-muenchen.de/~schuenem/
-